package com.example.producer;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.stream.function.StreamBridge;

@SpringBootTest
public class ProducerApplicationTest {

    @Autowired
    private StreamBridge streamBridge;

    @Test
    public void mqSendTest() {
        for (int i = 0; i < 10; i++) {
            String message = "Hello, world!" + i;
            // 将消息发送到指定生产管道
            streamBridge.send("rocketmq-producer-channel", message);
        }
    }
}
